4填空对于一个具有n个结点的单链表,在已知的结点*p后插入一个新结点的时间复杂度为O(___),在给定值为x的结点后插入一个新结点的时间复杂度为O(___)。(请依次填入,格式为(a)(b),如果您的答案中出现字母,请使用小写;后一空系统基于字符匹配来判定答案,所以您的答案中不要出现空格)Forasinglelinkedlistwithnnodes,andafteraknownnode*ptoinsertanewnode,thetimecomplexityisO(___);afteragivennodewithxvalueinsertanewnode,thetimecomplexityisO(___).(Ifyouranswercontainsletters,uselowercaseone.Thesecondblankisjudgedbystringmatching,Pleasemakesureyouranswerdon’tcontainanyblanks.)
5填空带头结点head的循环链表的尾结点tail的特点是:_____(提示:1.请使用“=”2.系统基于字符匹配来判定答案,所以您的答案中不要出现空格)Thecircularlinkedlistwithaheadnode,itstailnode’scharacteris:_____.(Hint:1.Pleaseuse”=”2.Thisproblemisjudgedbystringmatching,Pleasemakesureyouranswerdon’tcontainanyblanks.)
1单选设栈S和队列Q的初始状态为空,元素e1,e2,e3,e4,e5和e6依次通过栈S,一个元素出栈后即进队列Q,若6个元素出队的序列是e2,e4,e3,e6,e5,e1则栈S的容量至少应该是_____________。AssumethatthestackSandqueueQ’sinitialstateisempty,theelementse1,e2,e3,e4,e5ande6followedthroughstackS,anelementoutthestackmeansintothequeueQ.Ifthesequencethesixelementsoutofthequeueise2,e4,e3,e6,e5,e1thenstackSofcapacityshouldbeatleast_____________.(Thereisonlyonecorrectanswer)
A.6
B.2
C.3
D.4
2单选现有中缀表达式E=((100-4)/3+3*(36-7))*2。以下哪个是与E等价的后缀表达式?ExistinginfixexpressionE=((100-4)/3+3*(36-7))*2.WhichofthefollowingistheequivalentpostfixexpressionofE?(Thereisonlyonecorrectanswer)
A.*+/–10043*3–3672
B.((1004–)3/3(367–)*+)2*
C.*(+/(–1004)3*3(–367))2
D.1004–3/3367–*+2*
3多选队列的特点包括:Queue’featuresinclude:(Therearemorethanoneanswers.)
A.后进后出Last-inlast-out(LILO)
B.先进先出First-infirst-out(FIFO)
C.后进先出Last-infirst-out(LIFO)
D.先进后出First-inlast-out(FILO)
数据结构与算法
北京大学
军职在线答案
大学网课